﻿using System;
using System.Configuration;
using System.ServiceModel;

namespace In.Api.Helpers
{
    public static class WsClientFactory
    {
        /// <summary>
        /// 获取  预约 Web Service 的代理类
        /// </summary>
        /// <returns></returns>
        public static HisWs.NeusoftHisServiceSoapClient GetHisWsSoapClient()
        {
            var endpointAddress = ConfigurationManager.AppSettings["HisWsUrl"];

            var binding = new BasicHttpBinding();
            binding.MaxReceivedMessageSize = Int32.MaxValue;
            binding.MaxBufferSize = Int32.MaxValue;
            var ws = new HisWs.NeusoftHisServiceSoapClient(binding, new EndpointAddress(endpointAddress));
            return ws;
        }

        /// <summary>
        /// 获取 企业号 Web Service 的代理类
        /// </summary>
        /// <returns></returns>
        public static QyServiceReference.Service1SoapClient GetQyWsSoapClient()
        {
            var endpointAddress = ConfigurationManager.AppSettings["QyWsUrl"];

            var binding = new BasicHttpBinding();
            binding.MaxReceivedMessageSize = Int32.MaxValue;
            binding.MaxBufferSize = Int32.MaxValue;
            var ws = new QyServiceReference.Service1SoapClient(binding, new EndpointAddress(endpointAddress));
            return ws;
        }
    }
}